package com.lianxd.easybuy.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;

@WebServlet(urlPatterns = ("/users/login"))
public class loginServlet extends HttpServlet {

  @Override
  protected  void  doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
    request.setCharacterEncoding("UTF-8");
    response.setContentType("text/html;charset=UTF-8");

//    String mobile =  request.getParameter("mobile");
//    System.out.println("手机号"+mobile);
//
//    String[] hobbies = request.getParameterValues("hobbies");
//    System.out.println("业余爱好:" + Arrays.toString(hobbies));
//
//    Map<String,String[]> parameterMap = request.getParameterMap();
//    parameterMap.forEach((key,value) ->{
//      System.out.println("键Key = "+key);
//      System.out.println("值Value = "+Arrays.toString(value));
//    });

    String name = request.getParameter("name");
    System.out.println("姓名: "+name);

    String username = request.getParameter("username");
    System.out.println("用户名: "+username);

    String pwd = request.getParameter("pwd");
    System.out.println("密码: "+pwd);

    String repwd = request.getParameter("repwd");
    System.out.println("确认密码: "+repwd);

    String email = request.getParameter("email");
    System.out.println("电子邮箱: "+email);

    String sex = request.getParameter("sex");
    System.out.println("性别: "+sex);

    String[] hobbies = request.getParameterValues("hobby");
    System.out.println("爱好: "+Arrays.toString(hobbies));

    String birthday = request.getParameter("birthday");
    System.out.println("出生日期: "+birthday);

  }

}
